﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CrazyWorship1
{
    /// <summary>
    /// Interaction logic for OutRider.xaml
    /// </summary>
    public partial class Outrider : Window
    {
        public Outrider()
        {
            InitializeComponent();
        }
        public State CurrentState
        {
            get
            {
                return _currentState;
            }
            set
            {
                _currentState = value;
                if (Properties.Settings.Default.MaximizeOutRider)
                    Maximize(this);
            }
        }

        public static void Maximize(Window targetForm)
        {
            try
            {
                System.Drawing.Rectangle workingArea = System.Windows.Forms.Screen.AllScreens[0].WorkingArea;
                targetForm.Left = workingArea.Left;
                targetForm.Top = workingArea.Top;
                targetForm.Width = workingArea.Width;
                targetForm.Height = workingArea.Height;

                targetForm.WindowStyle = WindowStyle.None;
                targetForm.WindowState = WindowState.Maximized;
                targetForm.Topmost = true;
            }
            catch (ApplicationException)
            {
                targetForm.WindowStyle = WindowStyle.SingleBorderWindow;
                targetForm.WindowState = WindowState.Normal;
            }
        }
       
        State _currentState;
    }
   
}
